{% extends "base.html" %}
{% load static %}

{% block content %}
    <div class="container">
        <div class="row justify-content-center">
            <div class="col-md-8">
                <div class="card">
                    <div class="card-header">
                        <h4 class="mb-0">个人资料</h4>
                    </div>
                    <div class="card-body">
                        <form method="post" class="needs-validation" novalidate>
                            {% csrf_token %}

                            {% if form.errors %}
                                <div class="alert alert-danger">
                                    {% for field in form %}
                                        {% for error in field.errors %}
                                            <p class="mb-0">{{ field.label }}: {{ error }}</p>
                                        {% endfor %}
                                    {% endfor %}
                                </div>
                            {% endif %}

                            <div class="row">
                                <div class="col-md-6 mb-3">
                                    <label for="{{ form.username.id_for_label }}" class="form-label">工号</label>
                                    {{ form.username }}
                                    {% if form.username.help_text %}
                                        <div class="form-text">{{ form.username.help_text }}</div>
                                    {% endif %}
                                </div>
                                <div class="col-md-6 mb-3">
                                    <label for="{{ form.first_name.id_for_label }}" class="form-label">用户名</label>
                                    {{ form.first_name }}
                                </div>

                            </div>

                            <div class="row">

                                <div class="col-md-6 mb-3">
                                    <label for="{{ form.email.id_for_label }}" class="form-label">电子邮箱</label>
                                    {{ form.email }}
                                </div>
                            </div>

                            <div class="d-grid gap-2">
                                <button type="submit" class="btn btn-primary">保存修改</button>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
{% endblock %} 